package com.scs.application.modules.sys.controller;
import com.scs.application.core.mvc.controller.CrudController;
import com.scs.application.core.query.QueryContext;
import com.scs.application.core.query.QueryContextHolder;
import com.scs.application.modules.sys.entity.Role;
import com.scs.application.modules.sys.model.RestResult;
import com.scs.application.modules.sys.service.RoleService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 */
@RestController
@RequestMapping("/role")
public class RoleController extends CrudController<RoleService,Role> {

    @GetMapping("/listByUserId")
    public RestResult listByUserId(){
        QueryContext queryContext = QueryContextHolder.currentContext();
        String use_id = (String) queryContext.getParams().get("user_id");
        List<Role> list = service.listUserRole(use_id);
        return RestResult.ok("查询成功", list);
    }
}
